﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SWDataDB.BLL;
using SWDataDB.DAL;
using SWDataDB.Models;
using System.Data;

public partial class ZKImgInfo : System.Web.UI.Page
{
    public string zkid = null;
    public string OGC_DEPART, OPEOJ_NAME, OMINE_NAME, OPEOJ_CODE, OADMIN_REGION, OSHEET_NAME, OHX_PEOPLE, ZKCODE, ZKFILEID, ZKHC;//,ZKPSNUM;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            zkid = Request["zkid"];
            bind();
        }
    }



    //绑定数据源
    private void bind()
    {
        YXInfo zkquery = new YXInfo();
        if (zkid == null) {
            Response.Write("<script language=javascript>alert('没有对应的详细信息！');history.go(-1);</script>");
        }
        DataSet ds = zkquery.GetInfoByID(Convert.ToInt32(zkid));//根据zkcd在YX_TBL查找对应记录，因为
        DataTable dt = ds.Tables[0];
        if (ds != null && ds.Tables.Count >= 0 && ds.Tables[0].Rows.Count > 0)
        {

            ZKFILEID = dt.Rows[0]["ZL_FILE_ID"].ToString().Length == 0 ? null : dt.Rows[0]["ZL_FILE_ID"].ToString();//ZL_FILE_ID 在YX_TBL中
            ZKCODE = dt.Rows[0]["ZK_CODE"].ToString().Length == 0 ? null : dt.Rows[0]["ZK_CODE"].ToString();//ZL_FILE_ID 在YX_TBL中
            DataView dv = dt.DefaultView;
            //对用于分页的类的引用
            // PagedDataSource pds = new PagedDataSource();
            //pds.DataSource = dt.DefaultView;//设置数据源(DataTable类型)
            //pds.AllowPaging = true;


            //AspNetPager1.RecordCount = dv.Count;
            //pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
            //pds.PageSize = AspNetPager1.PageSize;
            dl_FileList.DataSource = dv;
            dl_FileList.DataBind();
        }
        else
        {
            Response.Write("<script language=javascript>alert('没有对应的详细信息！');history.go(-1);</script>");
        }




        //从著录表中获取对应的ZL_FILE_ID的信息

        ZLInfo ZLFILEIDQuery = new ZLInfo();
       
        ZL_TBL ZLTBL = ZLFILEIDQuery.SelectZLInfoByID(ZKFILEID);       
        OGC_DEPART = ZLTBL.O_GC_DEPART;        //馆藏机构: 	GC_DEPART
         OPEOJ_NAME = ZLTBL.O_PEOJ_NAME;        //项目名称: 	PEOJ_NAME
         OMINE_NAME = ZLTBL.O_MINE_NAME;        //矿区名称: 	MINE_NAME
         OPEOJ_CODE = ZLTBL.O_PEOJ_CODE;        //项目编号: 	PEOJ_CODE
         OADMIN_REGION = ZLTBL.O_ADMIN_REGION;        //行政区:ADMIN_REGION
         OSHEET_NAME = ZLTBL.O_SHEET_NAME;        //图幅名称: SHEET_NAME
         OHX_PEOPLE = ZLTBL.O_HX_PEOPLE;        //汇交人





         //YXDeepthInfo xyDeepInfo = new YXDeepthInfo();
         //DataSet yxds = xyDeepInfo.SelectByZKCodeAndFID(ZKCODE, ZKFILEID);
         //DataTable yxdt = yxds.Tables[0];
         //DataView yxdv = yxdt.DefaultView;
         //YXRepeater.DataSource = yxdv;
         //YXRepeater.DataBind();



        // KCAdvanceQuery ZKIMG = new KCAdvanceQuery();
         //string[] ZKImgDs = ZKIMG.ZKImgHCDeep(ZKFILEID, ZKCODE);


         ZKImageInfo ZKIMG = new ZKImageInfo();
         DataSet ZKImgDS = ZKIMG.GetAllInfoWithSet(ZKFILEID, ZKCODE);
         DataTable zkimgdt = ZKImgDS.Tables[0];
         DataView zkimgdv = zkimgdt.DefaultView;

         if (ZKImgDS != null && ZKImgDS.Tables.Count >= 0 && ZKImgDS.Tables[0].Rows.Count > 0)//判断数据集是否为空
         {
        //获得数据集中回次
         ZKHC = zkimgdt.Rows[0]["HC"].ToString().Length == 0 ? null : zkimgdt.Rows[0]["HC"].ToString();//ZL_FILE_ID 在YX_TBL中
         //ZKPSNUM = zkimgdt.Rows[0]["PS_NUM"].ToString().Length == 0 ? null : zkimgdt.Rows[0]["PS_NUM"].ToString();
         //for (int i = 0; i < Convert.ToInt32(ZKPSNUM);i++ )
         //{
             
         //}

         repeater_ZKImg.DataSource = zkimgdv;
         repeater_ZKImg.DataBind();
        }
        else {
            
                Response.Write("<script language=javascript>alert('没有对应的图片信息！');history.go(-1); window.close();</script>");
           
         }







         //KCAdvanceQuery ZKDEEP = new KCAdvanceQuery();
         //DataSet ZKDEEPDS = ZKDEEP.ZKImgHCDeep(ZKFILEID, ZKCODE);
         //DataTable zkdeepdt = ZKDEEPDS.Tables[0];
         //DataView zkdeepdv = zkdeepdt.DefaultView;



         //repeater_ZKDEEP.DataSource = zkdeepdv;
         //    repeater_ZKDEEP.DataBind();
      
    }


}